PROJECT( PolstroLib )

INCLUDE_DIRECTORIES( ${LaboLib_SOURCE_DIR} )

SET( SOURCES
	 PolstroSerialInterface.h
	 PolstroSerialInterface.cpp )
	
IF( CMAKE_SYSTEM_NAME MATCHES Windows )
	SET( SOURCES
		 ${SOURCES}	
		 PolstroSerialInterfaceWindows.h
		 PolstroSerialInterfaceWindows.cpp)
		 
	# Set some Microsoft compiler specific options 
	IF( MSVC )
		# Set Unicode as character set for Visual Studio projects. By default it's Multi-Byte
		ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
			
		# Set Warning level to 4
		IF ( CMAKE_CXX_FLAGS MATCHES "/W[0-4]" )
			STRING( REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
		ELSE()
			SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4" )
		ENDIF()
	ENDIF()

ENDIF()

IF( CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME MATCHES Darwin )		
	SET( SOURCES
		 ${SOURCES}	
		 PolstroSerialInterfacePOSIX.h			# Could also be used on Windows with MinGW
		 PolstroSerialInterfacePOSIX.cpp )
ENDIF()

ADD_LIBRARY( ${PROJECT_NAME} STATIC ${SOURCES} )
	
